//
//  AppDelegate+QSUShare.swift
//  TestSwift
//
//  Created by Song on 2018/7/3.
//  Copyright © 2018年 Song. All rights reserved.
//

import Foundation

extension AppDelegate {
    /// 注册友盟分享
    func qs_registerUShare() {
        let wechat = QSPlatformInfo.init(platformType: .wechatSession, appKey: kWeChatAppKey, appSecret: kWeChatAppSecret, redirectURL: nil)
        let qq = QSPlatformInfo.init(platformType: .QQ, appKey: kQQAppKey, appSecret: nil, redirectURL: nil)
        let Sina = QSPlatformInfo.init(platformType: .sina, appKey: kSinaAppKey, appSecret: kSinaAppSecret, redirectURL: nil)
        let dingding = QSPlatformInfo.init(platformType: .dingDing, appKey: kDingDingAppKey, appSecret: nil, redirectURL: nil)
        
        QSUMengManager.qs_registerUMeng(platformArray: [wechat, qq, Sina, dingding])
    }
    
    /// 友盟分享回调
    ///
    /// 在该方法 func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool 中调用
    func qs_UShareCallBack(withUrl: URL) -> Bool {
        let result = UMSocialManager.default().handleOpen(withUrl, sourceApplication: "", annotation: "")
        
        return result
    }
}
